/*
 * @Description  :
 * @Autor        : yanwang
 * @CreateDate   : 2023-04-20 15:25:23
 * @LastEditors  : yanwang
 * @LastEditTime : 2023-04-20 16:40:52
 */
const {
  override,
  addWebpackAlias,
  addWebpackExternals,
} = require('customize-cra');
const addLessLoader = require('customize-cra-less-loader');
const path = require('path');

// 更改打包路径
const paths = require('react-scripts/config/paths');
paths.appBuild = path.join(path.dirname(paths.appBuild), 'dist');

module.exports = override(
  addLessLoader({
    lessLoaderOptions: {
      lessOptions: {
        javascriptEnabled: true,
        modifyVars: {
          '@primary-color': '#038fde',
        },
      },
    },
  }),
  addWebpackAlias({
    '@': path.resolve(__dirname, 'src'),
  }),
  addWebpackExternals({
    'mapbox-gl': 'mapboxgl',
    '@sakitam-gis/mapbox-gl': 'mapboxgl',
    jquery: 'jquery',
  }),

  (config) => {
    return config;
  }
);
